package cz.proks.bank.service.domain;

import java.io.Serializable;
import java.util.Date;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(namespace = "http://bank.proks.cz/service/FileService/")
@XmlAccessorType(XmlAccessType.FIELD)
public class ReportRequest implements Serializable {	
	@XmlElement(required = true)
	private String bankCode;
	
	@XmlElement(required = true)
	private Integer accountNumber;
	
	@XmlElement	
	private AccountRecord[] records;
	
	public ReportRequest() {
		// TODO Auto-generated constructor stub
	}
		
	public ReportRequest(String bankName, Integer accountNumber,
			AccountRecord[] records) {
		super();
		this.bankCode = bankName;
		this.accountNumber = accountNumber;
		this.records = records;
	}

	public String getBankCode() {
		return bankCode;
	}

	public void setBankCode(String bankCode) {
		this.bankCode = bankCode;
	}

	public Integer getAccountNumber() {
		return accountNumber;
	}

	public void setAccountNumber(Integer accountNumber) {
		this.accountNumber = accountNumber;
	}

	public AccountRecord[] getRecords() {
		return records;
	}

	public void setRecords(AccountRecord[] records) {
		this.records = records;
	}
	
	@XmlRootElement(namespace = "http://bank.proks.cz/service/FileService/")
	@XmlAccessorType(XmlAccessType.FIELD)
	public static class AccountRecord implements Serializable {
		@XmlEnum
		public enum  OperationType { MONEY_WITHDRAW, MONEY_DEPOSIT, OUTGOING_PAYMENT, INGOING_PAYMENT, NEW_ACCOUNT, NEW_LOAN, LOAN_REPAYMENT }
		
		@XmlElement(required = true)
		private Date date;
				
		@XmlElement(required = true)
		private OperationType operationType;
		
		@XmlElement(required = false)
		private String additionalInformation;
		
		public AccountRecord() {
			// TODO Auto-generated constructor stub
		}
		
		public AccountRecord(Date date, OperationType operationType,
				String additionalInformation) {
			super();
			this.date = date;
			this.operationType = operationType;
			this.additionalInformation = additionalInformation;
		}

		public Date getDate() {
			return date;
		}

		public void setDate(Date date) {
			this.date = date;
		}

		public OperationType getOperationType() {
			return operationType;
		}

		public void setOperationType(OperationType operationType) {
			this.operationType = operationType;
		}

		public String getAdditionalInformation() {
			return additionalInformation;
		}

		public void setAdditionalInformation(String additionalInformation) {
			this.additionalInformation = additionalInformation;
		}		
	}
}
